Source Code Viewer - Example 6 - UserRatingPK

package name.matthewgreet.example6.model;

import java.io.Serializable;
import java.util.Objects;

public class UserRatingPK implements Serializable {
    private static final long serialVersionUID = -7209698653494032414L;
    
    public int gameId;
    public int userId;

    public UserRatingPK() {
        // Empty
    }

    public UserRatingPK(int gameId, int userId) {
        this.gameId = gameId;
        this.userId = userId;
    }

	public int getGameId() {
		return gameId;
	}
	public void setGameId(int gameId) {
		this.gameId = gameId;
	}


    public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}

	
	@Override
	public int hashCode() {
		return Objects.hash(gameId, userId);
	}

    @Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserRatingPK other = (UserRatingPK) obj;
		return gameId == other.gameId && userId == other.userId;
	}

    @Override
	public String toString() {
		return "UserRatingPK [gameId=" + gameId + ", userId=" + userId + "]";
	}

}